home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / ipack.exe / WHOIS.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-08-26  |  5.4 KB  |  181 lines

  1. VERSION 4.00
  2. Begin VB.Form WhoIsS1 
  3.    Caption         =   "WhoIs Sample Program"
  4.    ClientHeight    =   5445
  5.    ClientLeft      =   1095
  6.    ClientTop       =   2535
  7.    ClientWidth     =   9495
  8.    Height          =   5850
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    LockControls    =   -1  'True
  12.    ScaleHeight     =   5445
  13.    ScaleWidth      =   9495
  14.    Top             =   2190
  15.    Width           =   9615
  16.    Begin VB.CommandButton cmdExit 
  17.       Caption         =   "Exit WhoIs Sample"
  18.       Height          =   375
  19.       Left            =   6720
  20.       TabIndex        =   6
  21.       Top             =   1320
  22.       Width           =   2535
  23.    End
  24.    Begin VB.CommandButton cmdWhoIsQueryBlocking 
  25.       Caption         =   "WhoIs Query (Blocking)"
  26.       Height          =   375
  27.       Left            =   6720
  28.       TabIndex        =   5
  29.       Top             =   720
  30.       Width           =   2535
  31.    End
  32.    Begin VB.CommandButton cmdWhoIsQueryNonBlocking 
  33.       Caption         =   "WhoIs Query (Non-Blocking)"
  34.       Height          =   375
  35.       Left            =   6720
  36.       TabIndex        =   2
  37.       Top             =   240
  38.       Width           =   2535
  39.    End
  40.    Begin VB.TextBox txtQueryResults 
  41.       Height          =   3255
  42.       Left            =   240
  43.       Locked          =   -1  'True
  44.       MultiLine       =   -1  'True
  45.       ScrollBars      =   3  'Both
  46.       TabIndex        =   1
  47.       Top             =   1920
  48.       Width           =   6135
  49.    End
  50.    Begin VB.TextBox txtQuery 
  51.       Height          =   285
  52.       Left            =   240
  53.       TabIndex        =   0
  54.       Top             =   480
  55.       Width           =   6135
  56.    End
  57.    Begin VB.Label Label5 
  58.       Caption         =   $"whois.frx":0000
  59.       Height          =   1215
  60.       Left            =   6720
  61.       TabIndex        =   10
  62.       Top             =   3600
  63.       Width           =   2535
  64.    End
  65.    Begin WhoisLib.WhoIs WhoIs1 
  66.       Left            =   9000
  67.       Top             =   4920
  68.       _Version        =   327680
  69.       _ExtentX        =   847
  70.       _ExtentY        =   847
  71.       _StockProps     =   64
  72.       Blocking        =   -1  'True
  73.       Query           =   ""
  74.       Host            =   "WHOIS.INTERNIC.NET"
  75.    End
  76.    Begin VB.Label Label3 
  77.       Caption         =   $"whois.frx":00BF
  78.       Height          =   1575
  79.       Left            =   6720
  80.       TabIndex        =   9
  81.       Top             =   1920
  82.       Width           =   2535
  83.    End
  84.    Begin VB.Label lblErrorNumber 
  85.       BorderStyle     =   1  'Fixed Single
  86.       Height          =   285
  87.       Left            =   240
  88.       TabIndex        =   7
  89.       Top             =   1320
  90.       Width           =   6135
  91.    End
  92.    Begin VB.Label Label2 
  93.       Caption         =   "Query Results:"
  94.       Height          =   255
  95.       Left            =   240
  96.       TabIndex        =   4
  97.       Top             =   1680
  98.       Width           =   1935
  99.    End
  100.    Begin VB.Label Label1 
  101.       Caption         =   "WhoIs Query:"
  102.       Height          =   255
  103.       Left            =   240
  104.       TabIndex        =   3
  105.       Top             =   240
  106.       Width           =   1935
  107.    End
  108.    Begin VB.Label Label4 
  109.       Caption         =   "Query Error Code:"
  110.       Height          =   255
  111.       Left            =   240
  112.       TabIndex        =   8
  113.       Top             =   1080
  114.       Width           =   1935
  115.    End
  116. Attribute VB_Name = "WhoIsS1"
  117. Attribute VB_Creatable = False
  118. Attribute VB_Exposed = False
  119. Option Explicit
  120. Private Sub cmdExit_Click()
  121.    ' Get out.
  122.    End
  123.    End Sub
  124. Private Sub cmdWhoIsQueryBlocking_Click()
  125.    Dim Index
  126.    ' Clear results boxes.
  127.    txtQueryResults.Text = ""
  128.    lblErrorNumber.Caption = ""
  129.    ' Start the query by getting the IP address
  130.    ' of the InterNIC's WhoIs server.  When this
  131.    ' is complete, the rest of the query is
  132.    ' handled by the WhoIs1_Done event
  133.    ' event.
  134.    Whois1.Blocking = True
  135.    Whois1.Query = txtQuery.Text
  136.    Whois1.GetWhoIs
  137.    ' Place all of the results into the Query
  138.    ' results text box.
  139.    For Index = 0 To Whois1.ResponseCount - 1
  140.       If Index <> 0 Then
  141.          txtQueryResults.Text = txtQueryResults.Text & Chr(13) & Chr(10)
  142.          End If
  143.          
  144.       txtQueryResults.Text = txtQueryResults.Text & Whois1.Response(Index)
  145.       Next Index
  146.    End Sub
  147. Private Sub cmdWhoIsQueryNonBlocking_Click()
  148.    ' Clear results boxes.
  149.    txtQueryResults.Text = ""
  150.    lblErrorNumber.Caption = ""
  151.    ' Start the query by getting the IP address
  152.    ' of the InterNIC's WhoIs server.  When this
  153.    ' is complete, the rest of the query is
  154.    ' handled by the WhoIs1_Done event
  155.    ' event.
  156.    On Error Resume Next
  157.    Whois1.Blocking = False
  158.    Whois1.Query = txtQuery.Text
  159.    Whois1.GetWhoIs
  160.    On Error GoTo 0
  161.    End Sub
  162. Private Sub Whois1_Done(ErrorCode As Integer)
  163.    Dim Index
  164.    lblErrorNumber = "Error code: " & ErrorCode
  165.    ' If we handled this in blocking (synchronous)
  166.    ' mode, skip the rest (no need for it).
  167.    If Whois1.Blocking Then
  168.       Exit Sub
  169.       End If
  170.       
  171.    ' Place all of the results into the Query
  172.    ' results text box.
  173.    For Index = 0 To Whois1.ResponseCount - 1
  174.       If Index <> 0 Then
  175.          txtQueryResults.Text = txtQueryResults.Text & Chr(13) & Chr(10)
  176.          End If
  177.          
  178.       txtQueryResults.Text = txtQueryResults.Text & Whois1.Response(Index)
  179.       Next Index
  180.    End Sub
  181.